﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_DSLoaiSanPham : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    private void MessageBox(string msg)
    {
        Page.Controls.Add(new LiteralControl(
         "<script language='javascript'> window.alert('" + msg.Replace("'", "\\'") + "');location.href='DSLoaiSanPham.aspx';</script>"));
    }

    protected void lkbtnThem_Click(object sender, EventArgs e)
    {
        LoaiSanPhamDTO lspDto = new LoaiSanPhamDTO();
        lspDto.TenLoaiSP = txtTenLoaiSP.Text;
        lspDto.MoTa = txtMoTa.Text;
        lspDto.Visible = true;

        LoaiSanPhamBUS objLoaiSP = new LoaiSanPhamBUS(TGDDConfiguration.DbConnectionString);
        if (objLoaiSP.InsertLoaiSanPham(lspDto))
        {
            MessageBox("Thêm thành công");

        }
        else
        {
            MessageBox("Thêm thất bại");
        }
    }
}
